//
//  Http.h
//  AGG_V2
//
//  Created by admin on 15/5/12.
//  Copyright (c) 2015年 admin. All rights reserved.
//

#import "AFNetworking.h"


typedef enum {
    GET =1,//GET
    POST =2,//POST
   
}Methods;

typedef void (^DataDownloadCompletion)(id data, NSError *error);

@interface Http : NSObject

+ (instancetype)sharedInstance;

#pragma mark - NSURLSession

- (NSURLSessionDataTask *)requestForMethod:(Methods)Meth  Url:(NSString *)url
                               withParams:(NSDictionary *)params
                               completion:(DataDownloadCompletion)completion;

- (NSURLSessionDataTask *)uploadDataWithUrl:(NSString *)url
                                   withParams:(NSDictionary *)params
                    constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
                                   completion:(DataDownloadCompletion)completion;
/**
 上传图像
 */
- (NSURLSessionDataTask *)uploadImgDataWithUrl:(NSString *)url withParams:(NSDictionary *)params constructingBodyWithBlock:(void (^)(id<AFMultipartFormData>))block progress:(void (^)(NSProgress * _Nonnull uploadProgress))progress completion:(DataDownloadCompletion)completion;


#pragma mark - NSURLSession

- (NSURLSessionDataTask *)sessionRequestForMethod:(Methods)Meth Url:(NSString *)url
                                    withParams:(NSDictionary<NSString *, id> *)params
                                    completion:(DataDownloadCompletion)completion;

@end
